import {createRouter, createWebHashHistory} from 'vue-router'
import Index from '../pages/Index.vue'
import About from '../pages/About.vue'
import NotFound from '../pages/NotFound.vue'
import Login from '../pages/Login.vue'
import adminVue from '../layout/admin.vue'
import ProjectList from "~/pages/inner_projects/jbyg_list.vue"
import FGDProjectList from "~/pages/inner_projects/fgd_list.vue"
import CodeGen from '~/pages/products_man/card_gen.vue'
import ResultsList from '~/pages/info_man/results_list.vue'
import SamplingList from '~/pages/info_man/sampling_list.vue'
import InfoList from '~/pages/info_man/info_list.vue'
import DetailList from '~/pages/special_statistics/data_analyze.vue'
import LocationList from '~/pages/special_statistics/location_analyze.vue'
import Dashboard from "~/layout/Dashboard.vue";
import deviceResults from "~/pages/device_data/data_results.vue"


const routes = [{
    path: "/", // 设置根路径为登录页面
    redirect: "/login", // 重定向到登录页面

},{
    path:"/about",
    component:About
},{
    path:"/login",
    component:Login,
    meta:{
        title:"登陆页面"
    }
}, {
    path:"/dashboard",
    component: Dashboard,
    meta: {
        title:"数据大屏"
    }
}, {
    path:"/index",
    component:adminVue,

    // 子路由
    children: [{
        path:"/index",
        component:Index,
        meta:{
            title:"管理页面"
        }
    },{
        path:"/inner_projects/jbyg_list",
        component:ProjectList,
        meta:{
            title:"检测卡项目"
        }
    },{
        path:"/inner_projects/fgd_list",
        component:FGDProjectList,
        meta:{
            title:"分光度项目"
        }
    },{
        path:"/products_man/card_gen",
        component:CodeGen,
        meta:{
            title:"二维码管理"
        }
    },{
        path:"/info_man/results_list",
        component: ResultsList,
        meta:{
            title:"检测结果"
        }
    },{
        path:"/info_man/sampling_list",
        component: SamplingList,
        meta:{
            title:"采样信息"
        }
    },{
        path:"/info_man/info_list",
        component: InfoList,
        meta:{
            title:"信息录入"
        }
    },{
        path:"/special_statistics/data_analyze",
        component: DetailList,
        meta:{
            title:"数据分析"
        }
    },{
        path:"/special_statistics/location_analyze",
        component: LocationList,
        meta:{
            title:"区域分析"
        }
    },{
        path: "/device_data/data_results",
        component: deviceResults,
        meta:{
            title:"设备数据"
        }
    }]
},  // 将匹配所有内容并将其放在 `$route.params.pathMatch` 下
{ 
    path: '/:pathMatch(.*)*', 
    name: 'NotFound', 
    component: NotFound 
},]

const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history:createWebHashHistory(),
    routes
  })
  

  export default router